Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mvj 531 seasonal rent dates validation #752

Merged
merged 5 commits into from
Oct 23, 2024
Merged

Conversation

henrinie-nc
Copy link
Contributor

@henrinie-nc henrinie-nc commented Oct 17, 2024

  • Adds validation to RentDueDateSerializer for due dates
  • Adds validation to RentCreateUpdateSerializer for valid season start and end "dates"

This partly solves issues of MVJ-529, validation is only implemented at API level for Serializers. If MVJ-529 requires e.g. model level validation, it should be implemented separately. The logic would be almost the same, but the exception would come from django instead of django restframework

if day is None and month is None:
return

if (day is None and month is not None) or (day is not None and month is None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be if day is None or month is None:? It is a bit simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, I've added validation for both cases now though. So if one is None and other is not

Copy link
Contributor

@NC-jsAhonen NC-jsAhonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@henrinie-nc henrinie-nc merged commit 4080431 into develop Oct 23, 2024
2 checks passed
@henrinie-nc henrinie-nc deleted the MVJ-531-seasonal-rents branch October 23, 2024 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants